import React, { useState } from 'react';
import {
    BrowserRouter as Router,
    Link,
    Switch,
    HashRouter,
    Route,
    Redirect
  } from "react-router-dom";
  import './index.less'
  import LoginIn from "./loginin/loginin";
  import Register from "./register/register";

function Login(){
     const [isActive, setIsActive] = useState(0);
     console.log(isActive);

    return (
        <Router>
            <div  className='con'>
                <div className='loginIndex'>
                    <div className='title'>
                        <div className='tit'>
                            <p 
                                className={isActive?'':'active'} 
                                onClick={()=>(
                                    setIsActive(0)
                                )}
                                >
                                <Link to='/login/loginin' className='col'>登录</Link>
                            </p>
                            <p 
                                className={isActive?'active':''} 
                                onClick={()=>(
                                    setIsActive(1)
                                )}
                                >
                                <Link to='/login/register' className='col'>注册</Link>
                            </p>
                        </div>
                    </div>
                    <div className='content'>
                        <Switch>
                            <Route path='/login/loginin'> <LoginIn></LoginIn>  </Route>
                            <Route path='/login/register'> <Register></Register>  </Route>
                            <Redirect to="/login/loginin"> <LoginIn></LoginIn> </Redirect>
                        </Switch>
                    </div>
               
                </div>
            </div>
        </Router>
    )
}
export default Login;